#include<bits/stdc++.h>
using namespace std;

int main()
{
	int x;
	cin >> x;
	char str[1010];
	int num = 1;
	int cnt = 0;
	int len = 1;
	while(true){
		if(!(cnt == 0 && num/x == 0))
			str[cnt++] = '0' + num/x;
		num %= x;
		if(num == 0){
			str[cnt] = '\0';
			cout << str << " " << len;
			break;
		}
		len++;
		num = num * 10 + 1;
	}
	return 0;
}
